<?xml version="1.0" encoding='utf-8'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method='html'/>
<xsl:decimal-format
name="slo"
decimal-separator="," 
grouping-separator="." 
/> 


	<xsl:template match="/">
	  <html>
	    <head>
	      <style type="text/css"><![CDATA[
table{
border-collapse:collapse;
border: 0mm;
}

td {
padding: 0.5mm 2mm 0.5mm 2mm;
white-space:nowrap;
}

th {
background-color: #aeaeae;
text-align: left;
padding: 0.5mm 2mm 0.5mm 2mm;
}

.num {
text-align: right}

.strong{
font-weight: bold;
}
]]>
      </style>
	    </head>
	    
	    <body>
		    <xsl:apply-templates select="Invoices/Invoice" />
		  </body>
		</html>
	</xsl:template>
	
	<xsl:template match="Invoice">
<div style="TEXT-ALIGN:center">
  <font size="1">Mobomind Kontnik k.d., Linhartova 15, 1000 Ljubljana, mobilni telefon: +386
  (31) 264 135 • ales.kotnik@mobomind.com • Internet:www.mobomind.com • obr mobo
  001 • IŠ: SI60259108 • Matična št.: 1714554 • Št. vložka: 1/3606/00 • Srg
  2002/02819 • številka transakcijskega računa 06000-0912208766 • račun je odprt
  pri Banki Celje, PE Ljubljana </font><br/>
</div>	
	  <br/>
	  <h1>Račun <xsl:value-of select='Id'/></h1>
 	  <br/>
	  <br/>
	  <table width='100%'>
	    <tr>
	    <td nowrap=''>
	      <b>Stranka</b><br/>
	      <xsl:apply-templates select='InvoicedParty/Party'/>
	    </td>	    
	    <td width='50%'></td>
	    <td nowrap=''>
	    <br/>
	    <xsl:apply-templates select='InvoicingParty/Party'/>
	    </td>
	    </tr>
	    <tr><td colspan='3'> </td></tr>
	    <tr>
	      <td colspan='2' valign='top'><font size='1'>Vse cene so v evrih.
        Od dneva zapadlosti računa
        zaračunavamo zakonske zamudne obresti.</font>
        </td>
	      <td nowrap='' valign='top'><font size='1'>
	      Datum dokumenta: <xsl:value-of select='DocumentDate'/><br/>
	      Obdobje storitve: <xsl:value-of select='DateFrom'/> - <xsl:value-of select='DateTo'/><br/>
	      Valuta: <xsl:value-of select='DateDue'/></font>
	      </td>	      
	    </tr>
 	    <tr><td colspan='3'> </td></tr>
	  </table>
	  <br/>
	  
	  <xsl:apply-templates select='LineItems'/>
	  <br/>
	  <table width='100%'>
	    <tr>
	    <td nowrap=''>
	    </td>	    
	    <td width='50%'></td>
	    <td nowrap='' align='right'>
	    <br/>
            <xsl:if test='count(LineItems/LineItem) &lt; 14'><br/><br/><br/></xsl:if>
	    Mobomind Kotnik k.d.<br/>
	    Direktor: Aleš Kotnik
	    </td>
	    </tr>
	  </table>
	  
		<p class="pb" style="page-break-after:always"> </p>
		<p></p>
	</xsl:template>

	<xsl:template match="Party">
		<xsl:value-of select='Desc'/><br/>
		<xsl:value-of select='Street'/><br/>
		<xsl:value-of select='concat(Zip," ",City)'/><br/>
		<xsl:value-of select='Country'/><br/><br/>
		IŠ: <xsl:value-of select='TaxNumber'/><br/>
	</xsl:template>

	<xsl:template match="LineItems">
          <xsl:variable name='fsize'>
		  <xsl:choose>
		  <xsl:when test='count(*) &gt; 15'>1</xsl:when>
		  <xsl:otherwise>2</xsl:otherwise>
	          </xsl:choose>
          </xsl:variable>

          <xsl:variable name='cellspacing'>
		  <xsl:choose>
		  <xsl:when test='count(*) &gt; 15'>0.5pt</xsl:when>
		  <xsl:otherwise>3pt</xsl:otherwise>
	          </xsl:choose>
          </xsl:variable>


	  <table width='100%' cellpadding='0' cellspacing='{$cellspacing}'>
	    <tr>
	      <th align='right'><font size='{$fsize}'>#</font></th>
	      <th align='left'><font size='{$fsize}'>koda</font></th>
	      <th align='left'><font size='{$fsize}'>opis</font></th>
	      <th class='num' align='right'><font size='{$fsize}'>cena/enoto</font></th>
	      <th class='num' align='right'><font size='{$fsize}'>količina</font></th>
	      <th align='left'><font size='{$fsize}'>em</font></th>
	      <th class='num' align='right'><font size='{$fsize}'>skupaj</font></th>
	    </tr>
	    <xsl:apply-templates select='LineItem' />
	    <tr><td colspan='7'> </td></tr>
	    <tr>
	      <td colspan='6' class='num strong' align='right'><font size='{$fsize}'>Skupaj brez DDV</font></td>
	      <td class='num strong' align='right'><font size='{$fsize}'><xsl:value-of select='format-number(../Total,"###.##0,00","slo")'/></font></td>	    
	    </tr>	      
	    <tr>
	      <td colspan='6' class='num strong' align='right'><font size='{$fsize}'>DDV 20% na osnovo <xsl:value-of select='format-number(../Total,"###.##0,00","slo")'/></font></td>
	      <td class='num strong' align='right'><font size='{$fsize}'><xsl:value-of select='format-number(../Ddv,"###.##0,00","slo")'/></font></td>
	    </tr>
	    <tr>
	      <td colspan='6' class='num strong' align='right'><b><font size='{$fsize}'>Vrednost računa</font></b></td>
	      <td class='num strong' align='right'><b><font size='{$fsize}'><xsl:value-of select='format-number(../TotalDdv,"###.##0,00","slo")'/></font></b></td>
	    </tr>
	  </table>
	</xsl:template>

	<xsl:template match="LineItem">
          <xsl:variable name='fsize'>
		  <xsl:choose>
		  <xsl:when test='count(../*) &gt; 15'>1</xsl:when>
		  <xsl:otherwise>2</xsl:otherwise>
	          </xsl:choose>
          </xsl:variable>

	  <tr>
	  <td align='right'><font size='{$fsize}'><xsl:value-of select='Id' /></font></td>
	  <td align='left'><font size='{$fsize}'><xsl:value-of select='AssetId' /></font></td>
	  <td align='left'><font size='{$fsize}'><xsl:value-of select='AssetDesc' /></font></td>
	  <td class='num' align='right'><font size='{$fsize}'><xsl:value-of select='format-number(ItemPrice,"###.##0,00000","slo")' /></font></td>
	  <td class='num' align='right'><font size='{$fsize}'><xsl:value-of select='Qty' /></font></td>
	  <td><font size='{$fsize}'><xsl:value-of select='Uom' /></font></td>
	  <td class='num' align='right'><font size='{$fsize}'><xsl:value-of select='format-number(Total,"###.##0,00","slo")' /></font></td>
	  </tr>
	</xsl:template>


</xsl:stylesheet>
